﻿@model String
@using Wheeler.Common.Extensions;
@using Wheeler.Web.Utility;

@{
    String pageTitle = "Import Auto Rickshaw Information Registered in BRTA";
    ViewBag.Title = Html.GetPageTitle(pageTitle);
    ViewData[AppConstants.ViewDataKeys.SELECTED_MENU] = AdminMenu.Import;
}

<div class="jb-page-heading">
    <h1>@pageTitle</h1>
    <div>Import Auto Rickshaw Information registered in BRTA Database. Please select an Excel file with BRTA data to import.</div>
</div>
<div class="jb-page-content">
    <form id="frmExcelFile" action="/Admin/FixedVehicle/Import" method="post" enctype="multipart/form-data">
        <input id="ExcelFile" type="file" name="ExcelFile" onchange="ValidateUpload();" class="hidden"/>
        <div class="input-append">
            <input type="text" name="ExcelFile_Cosmetic" id="ExcelFile_Cosmetic" placeholder="Select an Excel File" />
		    <a class="btn" onclick="$('#ExcelFile').click();">Browse</a>
        </div>
        @Html.ValidationMessage("ExcelFile_Cosmetic")
    </form>

    @if (!Model.IsNullOrEmpty())
    {
        if (Model.StartsWith("Could ")) {
            @:@Html.WarningMessageBox(Model, "Failed!")
        }
        else {
            @:@Html.SuccessMessageBox(Model, "Success!")
        }
    }
</div>
@section JavaScriptPlaceHolder
{
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $('#ExcelFile').change(function () {
                $('#ExcelFile_Cosmetic').val($(this).val());
            });            
        });

        function ValidateUpload() {
            if ($('#ExcelFile').val().length > 0) {
                ShowLoadingAnimation(false);
                $('#frmExcelFile').submit();
            }
            else
                return false;
            return true;
        }
    </script>
}